package com.lib76.buildCode.control;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.lib76.buildCode.dao.ProjectDao;
import com.lib76.buildCode.dto.AjaxResult;
import com.lib76.buildCode.model.Project;

/**
 * 功能插件页面控制
 * @author 张浩
 * @version 0.0.2
 */
@Controller
public class PlugController {

	@RequestMapping("/plugConfig")
	public String config(String code,Model model){
		model.addAttribute("project", ProjectDao.findByCode(code));
		return "plug";
	}
	
	/**
	 * 保存项目功能插件信息
	 * @param project
	 * @return
	 */
	@RequestMapping("/plugConfig/save")
	@ResponseBody
	public AjaxResult save(String code,String[] plugs){
		AjaxResult result = new AjaxResult(1);
		Project project = ProjectDao.findByCode(code);
		project.setPlugs(plugs);
		return result;
	}
}
